﻿using B.S.DataBasic.Domain.RBAC;
using B.S.DataBasic.ErrorCode;
using B.S.DataBasic.Read.API.Application;
using B.S.DataBasic.Read.API.Dtos;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.DataBasic.Read.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class UserController : ControllerBase
    {
        private readonly IMediator mediator;
        public UserController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        [HttpPost]
        public async Task<APIResult<User>> Login([FromQuery]LoginCommand login)
        {
            return await mediator.Send(login);
        }

        [HttpGet]
        public async Task<APIResult<APIPaging<TranceDto>>> TranceShow([FromQuery] ShowCommand login)
        {
            return await mediator.Send(login);
        }
    }
}
